<%--
  Created by IntelliJ IDEA.
  User: 君未洋
  Date: 2021/8/14
  Time: 11:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://www.springframework.org/security/tags" prefix="security" %>
<html>
<head>
  <title>首页</title>
</head>
<body>
<table>
  <h1>欢迎你<%--${username}--%>
    <%--<security:authentication property="principal.username"/>--%>
    <security:authentication property="name"/></h1>

  <tr>
    <td><a href="${pageContext.request.contextPath}/level1/1">1-1</a></td>
    <td><a href="${pageContext.request.contextPath}/level1/2">1-2</a></td>
    <td><a href="${pageContext.request.contextPath}/level1/3">1-3</a></td>
  </tr>

  <tr>
    <td><a href="${pageContext.request.contextPath}/level2/1">2-1</a></td>
    <td><a href="${pageContext.request.contextPath}/level2/2">2-2</a></td>
    <td><a href="${pageContext.request.contextPath}/level2/3">2-3</a></td>
  </tr>
  <security:authorize access="hasAnyRole('ROLE_PRODUCT')">
    <tr>
      <td><a href="${pageContext.request.contextPath}/level3/1">3-1</a></td>
      <td><a href="${pageContext.request.contextPath}/level3/2">3-2</a></td>
      <td><a href="${pageContext.request.contextPath}/level3/3">3-3</a></td>
    </tr>
  </security:authorize>
</table>
<%--<a href="${pageContext.request.contextPath}/logout">注销 </a>--%>
<form action="${pageContext.request.contextPath}/logout" method="post">
  <%--注意这里如果使用a标签的话默认是使用的get方式注销
  这个也会被拦截,最好是使用表单,然后使用post方法提交--%>
  <security:csrfInput/>
  <input type="submit" value="注销">
</form>
</body>
</html>
